package com.aaron.proxystudy.jdkProxy;

import java.lang.reflect.Proxy;

/**
 * @ClassName JdkProxyFactory
 * @description:
 * @author: 荣燊
 * @create: 2021-05-18 15:40
 **/
public class JdkProxyFactory {
    // o是前面传过来的,要代理的真实对象
    public static Object getProxy(Object o) {
        // 创建代理对象，然后返回
        return Proxy.newProxyInstance(
                o.getClass().getClassLoader(),
                o.getClass().getInterfaces(),
                new MyInvocationHandler(o)
                );
    }
}
